function findMin(nums: number[]): number {
    const len = nums.length;
    const mid = Math.floor(len / 2);

    if (len === 1) {
        return nums[0];
    }

    if (nums[mid] > nums[mid + 1]) {
        return nums[mid + 1];
    }

    return Math.min(findMin(nums.slice(0, mid)), findMin(nums.slice(mid)));
};
